package com.zhida.smartcontrol.pagehome.search;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.jay.tools.recycler.MultipleViewHolder;
import com.jay.tools.recycler.SingleRecyclerAdapter;
import com.zhida.smartcontrol.R;
import com.zhida.smartcontrol.pagehome.ProjectResultBean;

import java.util.List;

public class SearchAdapter extends SingleRecyclerAdapter<ProjectResultBean> {

    public SearchAdapter(@Nullable List<ProjectResultBean> data) {
        super(R.layout.item_search, data);
    }

    @Override
    protected void convert(MultipleViewHolder holder, ProjectResultBean info) {
        TextView tvItem = holder.getView(R.id.tv_item);

        tvItem.setText(info.getName());

        tvItem.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if (null != mListener) {
                    mListener.onClick(info, 0);
                }
            }
        });
    }
}
